package ptij.vocoder.baseModel.common;

import ptolemy.actor.*;
import ptolemy.kernel.*;
import ptolemy.kernel.util.*;
import ptolemy.data.ObjectToken;
import ptolemy.data.type.*;

import ptij.vocoder.baseModel.*;

//////////////////////////////////////////////////////////////////////////
//// WeigthAI
/** 

@author Ivan Jeukens
@version v 0.1 07/08/2003
*/
public class WeigthAi extends TypedAtomicActor {

    public WeigthAi(CompositeEntity container, String name) throws
            IllegalActionException, NameDuplicationException {
        super(container, name);

        A = new TypedIOPort(this, "A", true, false);
        A.setTypeEquals(BaseType.OBJECT);

        fac = new TypedIOPort(this, "fac", true, false);
        fac.setTypeEquals(BaseType.OBJECT);

        AExp = new TypedIOPort(this, "AExp", false, true);
        AExp.setTypeEquals(BaseType.OBJECT);
    }

    ///////////////////////////////////////////////////////////////////
    ////                     ports and parameters                  ////

    // Input ports
    public TypedIOPort A;
    public TypedIOPort fac;

    // Output Ports
    public TypedIOPort AExp;

    ///////////////////////////////////////////////////////////////////
    ////                         public methods                    ////

    public void initialize() throws IllegalActionException {
        super.initialize();
        
    }

    public void fire() throws IllegalActionException {
        ObjectToken obj = (ObjectToken) A.get(0);
        Short [] arg1 = (Short []) obj.getValue();
        
        obj = (ObjectToken) fac.get(0);
        Short [] arg2 = (Short []) obj.getValue();
        
        Short [] resp = _weigth_ai(arg1, arg2);
        obj = new ObjectToken(resp);
        AExp.broadcast(obj);
    }

    ///////////////////////////////////////////////////////////////////
    ////                         private methods                   ////

    private Short [] _weigth_ai(Short [] a, Short [] fac) {
        Short [] a_exp = new Short[Cnst.MP1];
        
        
        return a_exp;
    }


    ///////////////////////////////////////////////////////////////////
    ////                         private variables                 ////

}
